﻿using System;

class TribonacciTriangle
{
    static void Main(string[] args)
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

        long element1 = long.Parse(Console.ReadLine());
        long element2 = long.Parse(Console.ReadLine());
        long element3 = long.Parse(Console.ReadLine());

        int maxLines = int.Parse(Console.ReadLine());

        Console.WriteLine(element1);
        Console.WriteLine(element2 + " " + element3);

        for (int currentLine = 3; currentLine <= maxLines; currentLine++)
        {
            int elementsToWrite = currentLine;
            string nextLine = "";
            while (elementsToWrite > 0)
            {

                long nextElement = element3 + element2 + element1;
                element1 = element2;
                element2 = element3;
                element3 = nextElement;
                nextLine += " " + nextElement;
                elementsToWrite--;
            }
            Console.WriteLine(nextLine.Substring(1));
        }

    }
}
